From c3b00452f4bdba32d73f38cff88b3b95e8ec2299 Mon Sep 17 00:00:00 2001 From: Long Li Date: Wed, 16 Jul 2025 09:54:07 +0800 Subject: [PATCH] [PATCH] memfs_ll: fix deadlock in truncate operation Remove redundant mutex lock acquisition in the truncate() method to prevent deadlock. The issue occurs when memfs_setattr() already holds the mutex lock and then calls truncate(), which attempts to acquire the same lock again. Signed-off-by: Long Li Gbp-Pq: Name memfs_ll-fix-deadlock.patch --- example/memfs_ll.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/example/memfs_ll.cc b/example/memfs_ll.cc index 6038850..e587756 100644 --- a/example/memfs_ll.cc +++ b/example/memfs_ll.cc @@ -197,7 +197,6 @@ class Inode { void truncate(off_t size) { - std::lock_guard lock(mutex); std::lock_guard attr_lock(attr_mutex); if (size < content.size()) { content.resize(size); -- 2.30.2